<link rel="stylesheet" href="__PUBLIC_STATIC__/p_builder/css/table.css?v={:config('builder.version')}?v={:config('hiphp.version')}">
<div class="table-box">
    <table id="dataTable"></table>
</div>
{include file="block/layui" /}
<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="正常|关闭" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('status')}?id={{ d.id }}">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal">修改</a>
    <a href="{:url('remove')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a>
</script>
<script type="text/html" id="toolbar">
    <div class="hi-table-tool">
        <a href="{:url('add')}" class="layui-btn layui-btn-normal layui-btn-sm" title="添加管理员">&nbsp;添加</a>
        <a data-href="{:url('status?v=1')}" class="layui-btn layui-btn-sm hi-table-ajax">&nbsp;启用</a>
        <a data-href="{:url('status?v=0')}" class="layui-btn layui-btn-warm layui-btn-sm hi-table-ajax">&nbsp;禁用</a>
        <a data-href="{:url('remove')}" class="layui-btn layui-btn-danger layui-btn-sm j-page-btns">&nbsp;删除</a>
    </div>
</script>

<script type="text/javascript">
    layui.use(['table'], function() {
        var table = layui.table;
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}'
            ,skin: 'row'
            ,even: true
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter']
            ,cols: [[
                {type:'checkbox'}
                ,{field: 'name', title: '角色名称'}
                ,{field: 'intro', title: '角色简介'}
                ,{field: 'create_time', title: '创建时间'}
                ,{field: 'status', title: '状态', templet: '#statusTpl'}
                ,{title: '操作', templet: '#buttonTpl', width:120}
            ]]
        });
    });
</script>